//
//  GPMacro.h
//  aa
//
//  Created by lanou3g on 15/9/8.
//  Copyright (c) 2015年 heima. All rights reserved.
//

#ifndef GPMacro_h
#define GPMacro_h
#define ACTUALHEIGHT_LANDSCAPE self.view.frame.size.height > self.view.frame.size.width ? self.view.frame.size.height : self.view.frame.size.width
#define ACTUALWIDTH_LANDSCAPE self.view.frame.size.width > self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height

#define ACTUALHEIGHT_PORTRAIT self.view.frame.size.height < self.view.frame.size.width ? self.view.frame.size.height : self.view.frame.size.width
#define ACTUALWIDTH_PORTRAIT self.view.frame.size.width < self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height

//设备及屏幕
#define IPHONE5DEVICE [[UIScreen mainScreen] bounds].size.height == 568 || [[UIScreen mainScreen] bounds].size.width == 568 ? 1 : 0

#define SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define IOS7 (SYSTEM_VERSION >= 7 && SYSTEM_VERSION < 8)
#define IOS8 (SYSTEM_VERSION >= 8)

#define BACKGROUNDCOLOR [UIColor colorWithHexString:@"#f2f2f2"]
#define TEXTCOLOR [UIColor colorWithHexString:@"#4f4f4f"]
#define AppFont @"FZHTJW--GB1-0"
#define AppFontHei @"MicrosoftYaHei"
#define DEVICE_IS_IPHONE5 ([[UIScreen mainScreen] bounds].size.height == 568)
#define DEVICE_IS_IPHONE5_LANDSCAPE ([[UIScreen mainScreen] bounds].size.width == 568)

//获取AppDelegate
#define ApplicationDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)

//获取屏幕的高
#define SCREEN_HEIGHT_LC [[UIScreen mainScreen] bounds].size.height
//获取屏幕的宽
#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
//判断是否是4.0的屏幕
#define SCREEN_4_0 ([[UIScreen mainScreen] bounds].size.height == 568)
//判断是否是iOS7
#define SYSTEM_VERSION_7_0 ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)
//判断系统版本定义坐标启示位置
#define SYSTEM_VERSION_7_Y (SYSTEM_VERSION_7_0 ? 20.f : 0.f)
#define SYSTEM_VERSION_7_NAV_Y (SYSTEM_VERSION_7_0 ? 64.f : 44.f)


//视图坐标计算
#define kViewWidth(view) view.frame.size.width
#define kViewHeight(view) view.frame.size.height
#define kViewXPoint(view) view.frame.origin.x
#define kViewYPoint(view) view.frame.origin.y
#define kViewRightPoint(view) (view.frame.origin.x+view.frame.size.width)
#define kViewBottomPoint(view) (view.frame.origin.y+view.frame.size.height)

#define kToSelfViewTop CGRectMake(0, -(self.view.frame.size.height), self.view.frame.size.width, self.view.frame.size.height)
#define kToSelfViewBounds self.view.bounds

#pragma mark -
#pragma mark ————————————获取本地资源的路径———————


#define RESOURCE_OF_PATH(NAME, EXT)         [[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]

#pragma mark -
#pragma mark————————————获取图片路径———————
// PNG JPG 图片路径
#define PNGPATH(NAME)           [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"png"]
#define JPGPATH(NAME)           [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"jpg"]

// 加载图片

#define IMAGE(NAME, EXT) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]]
#define PNG_IMAGE(NAME)          [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]]
#define JPG_IMAGE(NAME)          [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]]
#define IMAGE_FOR_NAME(NAME) [UIImage imageNamed:NAME]

#pragma mark -
#pragma mark ___ 沙盒路径  ___
// 获得应用documentspath目录路径
#define PATH_OF_DOCUMENTSPATH [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

// 获得 Temp 临时目录路径
#define PATH_OF_TEMP NSTemporaryDirectory()

// 获得 Caches 缓冲目录文件
#define PATH_OF_CACHES [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]
//隐藏网络指示器
#define kHUDHide(hud) [hud hide:YES afterDelay:.5f];

//判断字符串是否为空且长度为0
#define kIsStringEqualToTheNull(str) (str == nil && str.length < 1)

//NSUserDefaults 存取 删除
#define USER_DEFAULT_SET(value,key) [[NSUserDefaults standardUserDefaults]setValue:value forKey:key]
#define USER_DEFAULT_GET(key)  [[NSUserDefaults standardUserDefaults]valueForKey:key]
#define USER_DEFAULT_REMOVE(key)  [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]


#define NULL_STR(str) (str == nil || (NSNull *)str == [NSNull null] || [str isEqualToString:@""]) //判断对象为空
#endif
